﻿/***********************************************
  [className] CPdfRptBase
  [func]      pdf报表业务基类
  [author]    WeiXiaoYu
  [date]      2025/01/08 16:00
  [log]       初次建立
[Modification Log]
Vers            By            Notes
************************************************/

#ifndef CPdfRptBase_H
#define CPdfRptBase_H
#include <QMap>
#include "CPdfRptTool.h"
#include "CPdfRptRestOper.h"

//纠偏单个报警信息
struct SPdfRecSglAlmInfo
{
	QString m_sPictureUrl;//图片URL地址(现在改成了http图片地址)
	QString m_sBeltName;//皮带名称
	QString m_sRecPointName;//纠偏点名称
	QString m_sRecStartTime;//跑偏开始时间
	QString m_sRecEndTime;//跑偏结束时间
	QString m_sAlmDesc;//检测描述
	int m_nAlmType;//报警等级(0:未报警 1:报警) PS:新增本字段，用于区分存储非报警信息
	double m_dLeftCurVal;//左侧实时偏离值mm
	double m_dRightCurVal;//右侧实时偏离值mm
	int m_nReaSetValOne;//判定一级跑偏设定值(mm)
	int m_nReaSetValTwo;//判定二级跑偏设定值(mm)
	double m_dLeftAvgVal;//左侧平均偏离值(mm)
	double m_dRightAvgVal;//右侧平均偏离值(mm)

	SPdfRecSglAlmInfo()
	{
		m_sPictureUrl = "";
		m_sBeltName = "";
		m_sRecPointName = "";
		m_sRecStartTime = "";
		m_sRecEndTime = "";
		m_sAlmDesc = "";
		m_nAlmType = 0;//默认不报警

		m_dLeftCurVal = 0;
		m_dRightCurVal = 0;
		m_nReaSetValOne = 0;
		m_nReaSetValTwo = 0;
		m_dLeftAvgVal = 0;
		m_dRightAvgVal = 0;
	}
};

//纠偏报表数据信息
class CPdfRptRectifyDataInfo
{
public:
	QString m_sOutputPdfFolder;//输出pdf文件夹(完整本地路径)

	QString m_sBeltName;//皮带名称
	QString m_sDetTime;//检测日期 2024-05-13
	QString m_sDetStartTime;//检测开始时间 15:27:20
	QString m_sDetEndTime;//检测结束时间 16:30:45
	int m_nAlmCount;//报警项数(报警的实际数量，不包括非报警)
	QString m_sComment;//备注

	QVector<SPdfRecSglAlmInfo> m_vecFormRecAlmInfo;//纠偏报警信息容器(重新设定下包含非报警信息)

	CPdfRptRectifyDataInfo()
	{
		m_sOutputPdfFolder = "";

		m_sBeltName = "";
		m_sDetTime = "2025-01-01";
		m_sDetStartTime = "00:01:00";
		m_sDetEndTime = "00:35:00";
		m_nAlmCount = 0;
		m_sComment = "";

	}
};

//所有pdf报表数据集合
class CAllPdfRptDataInfo
{
public:
	CPdfRptRectifyDataInfo rectifyDataInfo;//纠偏报表数据信息

	CAllPdfRptDataInfo()
	{
	}
};

class CPdfRptBase  : public QObject
{
	Q_OBJECT

public:
	CPdfRptBase();
	virtual ~CPdfRptBase();

	/***************************************************************
	* @brief     函数功能:绘制报告名称
	* @input     sRptName|报告名称
	* @input     ePosition|绘制位置枚举
	* @input     painter|QPainter对象
	* @input     printer|QPrinter对象
	* @output    sErrMsg|错误描述
	* @return    bool |成功返回true，失败返回false
	* @note
	* @author    WeiXiaoYu
	* @time      2025-01-08 13:30
	* @Modification Log]
	 Vers            By            Notes
	**************************************************************/
	bool drawRptName(QString sRptName, EPdfRptComPosition ePosition, QPainter &painter, QPrinter &printer, QString &sErrMsg);

	/***************************************************************
	* @brief     函数功能:输出其他AI检测报表信息
	* @input     dataInfo|pdf报表数据
	* @output    sErrMsg|错误描述
	* @return    bool |成功返回true，失败返回false
	* @note      备注
	* @author    WeiXiaoYu
	* @time      2025-01-08 17:00
	* @Modification Log]
	 Vers            By            Notes
	**************************************************************/
	bool optRestPdfRptInfo(CAllPdfRptDataInfo &dataInfo, QString &sErrMsg);//输出其他AI检测报表信息

public:
	CPdfRptTool *m_pPdfRptTool = nullptr;//声明工具类指针 (在子类中new,并且传入操作类中)
	CPdfRptRestOper *m_pPdfRptRestOper = nullptr;//声明其他AI检测操作基类
};
#endif
